<?php 
	class School_page_modulars extends CI_Model{

		function __construct(){
			parent::__construct();
		}

		function get_school_page_modulars($school_id, $type = 1){
			$sql = "SELECT m.* FROM {$this->db->dbprefix}o2o_school_page_modulars AS m ";
			$sql .= "LEFT JOIN {$this->db->dbprefix}o2o_school_notshow_page_modulars AS nm ON(nm.mid=m.id AND nm.school_id='{$school_id}') ";
			$sql .= "WHERE nm.id IS NULL AND type=$type";
			return $this->db->query($sql)->result_array();
		}

		function get_all_school_page_modulars($school_id){
			$sql = "SELECT m.*,nm.id AS nid FROM {$this->db->dbprefix}o2o_school_page_modulars AS m ";
			$sql .= "LEFT JOIN {$this->db->dbprefix}o2o_school_notshow_page_modulars AS nm ON(nm.mid=m.id AND nm.school_id='{$school_id}') ORDER BY m.id ASC";
			return $this->db->query($sql)->result_array();
		}
	}